; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc --mtriple=loongarch32 --loongarch-numeric-reg < %s \
; RUN:   | FileCheck %s --check-prefix=LA32
; RUN: llc --mtriple=loongarch64 --loongarch-numeric-reg < %s \
; RUN:   | FileCheck %s --check-prefix=LA64

@.str_1 = internal constant [7 x i8] c"hello\0A\00"

declare i32 @printf(ptr, ...)

define i32 @main() {
; LA32-LABEL: main:
; LA32:       # %bb.0:
; LA32-NEXT:    addi.w $r3, $r3, -16
; LA32-NEXT:    .cfi_def_cfa_offset 16
; LA32-NEXT:    st.w $r1, $r3, 12 # 4-byte Folded Spill
; LA32-NEXT:    .cfi_offset 1, -4
; LA32-NEXT:    pcalau12i $r4, %pc_hi20(.str_1)
; LA32-NEXT:    addi.w $r4, $r4, %pc_lo12(.str_1)
; LA32-NEXT:    bl %plt(printf)
; LA32-NEXT:    move $r4, $r0
; LA32-NEXT:    ld.w $r1, $r3, 12 # 4-byte Folded Reload
; LA32-NEXT:    addi.w $r3, $r3, 16
; LA32-NEXT:    ret
;
; LA64-LABEL: main:
; LA64:       # %bb.0:
; LA64-NEXT:    addi.d $r3, $r3, -16
; LA64-NEXT:    .cfi_def_cfa_offset 16
; LA64-NEXT:    st.d $r1, $r3, 8 # 8-byte Folded Spill
; LA64-NEXT:    .cfi_offset 1, -8
; LA64-NEXT:    pcalau12i $r4, %pc_hi20(.str_1)
; LA64-NEXT:    addi.d $r4, $r4, %pc_lo12(.str_1)
; LA64-NEXT:    bl %plt(printf)
; LA64-NEXT:    move $r4, $r0
; LA64-NEXT:    ld.d $r1, $r3, 8 # 8-byte Folded Reload
; LA64-NEXT:    addi.d $r3, $r3, 16
; LA64-NEXT:    ret
  %s = getelementptr [7 x i8], ptr @.str_1, i64 0, i64 0
  call i32 (ptr, ...) @printf(ptr %s)
  ret i32 0
}
